<template>
  <div>
    App: {{ money }}
    <Son :money="money" @updateMoney="updateMoney" />
  </div>
</template>

<script>
import { ref } from 'vue'
import Son from './Son.vue'
export default {
  components: {
    Son,
  },
  setup() {
    const money = ref(100)
    const updateMoney = (m) => {
      // #2 父亲在自定义事件的回调中接收参数并修改自身的数据
      money.value += m
    }
    return {
      money,
      updateMoney,
    }
  },
}
</script>
